GBML manual / Backgrounds

perspective_floor_ahead

How far ahead of the camera, along the way it looks, the floor place (x, y) is, in picture pixels. Negative behind the camera.

Game Boy: not available

Game Boy Color: not available

Sega Genesis: not built yet - The Sega Genesis will draw the road its own way.

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

perspective_floor_ahead(x, y) -> real

Arguments

NameType
xreal
yreal

Returns

real

Description

How far ahead of the camera, along the way it looks, the floor place (x, y) is, in picture pixels. Negative when the place is behind the camera.

This is the floor distance helper: a place's depth in front of the camera, for a driver that brakes for what is ahead, or to sort things. For the distance between two places on the floor, use dist_to: floor places are plain picture pixels, so it needs no help.

Example

// Step event of a pickup: it is hidden once the camera has gone past it.
if (perspective_floor_ahead(x, y) < 0) { visible = false; }

A pickup the camera has passed stops being shown.

On the GBA

The floor distance helper: a place’s depth in front of the camera, for a driver that brakes for what is ahead or for sorting. For the distance between two floor places use dist_to: floor places are plain picture pixels.

See also: Perspective floordist_tofloor_scale_atperspective_floor_project